
const path_pre = "/pages"
const index_page = path_pre + "/index/index"
const bill_page = path_pre + "/bill/bill"
const bind_phone_page = path_pre +"/bind-phone/bind-phone"
const bind_book_page = path_pre +"/bind-house/bind-house"
const add_book_page = path_pre +"/add-book/add-book"
const book_detail_page = path_pre + "/book-detail/book-detail"
const bill_pay_page = path_pre + "/bill-pay/bill-pay"
const record_detail_page = path_pre + "/record-detail/record-detail"
const advice_page = path_pre + "/advice/advice"
const record_page = path_pre + "/record/record"
// ,
//   "pages/book-detail/book-detail",
//   "pages/add-book/add-book",

//   "pages/test/test",
//   ,
//   "pages/logs/logs"


function toIndexPage() {
  wx.switchTab({
    url: index_page,
  })
}

function toBillPage() {
  wx.switchTab({
    url: bill_page,
  })
}


function toBindBookPage(data) {
  wx.navigateTo({
    url: bind_book_page
  })
  
}

function toBindPhonePage() {
  wx.navigateTo({
    url: bind_phone_page
  })
}

function toBookDeatilPage(data) {
  if (data) {
    data = JSON.stringify(data)
    wx.navigateTo({
      url: book_detail_page + "?data=" + data
    })
  } 
}


function toBillPayPage(data) {
  if (data) {
    data = JSON.stringify(data)
    wx.navigateTo({
      url: bill_pay_page + "?data=" + data
    })
  }
}

function toRecordDeatilPage(data) {
  if (data) {
    data = JSON.stringify(data)
    wx.navigateTo({
      url: record_detail_page + "?data=" + data
    })
  }
}

function toAdvicePage() {
  wx.navigateTo({
    url: advice_page
  })
}

function toRecordPage() {
  wx.navigateTo({
    url: record_page
  })
}

module.exports = {
  toBindBookPage, toBindPhonePage, toIndexPage, toBookDeatilPage, toBillPayPage, toRecordDeatilPage, toAdvicePage, toBillPage, toRecordPage
}